<?

class model_test1 extends bf_sql_model {

	protected function sql_count($sql_filters) {
		return "select count(*) from t1 where $sql_filters";
	}

	protected function sql_select($sql_filters) {
		return "select * from t1 where $sql_filters order by a limit \$2 offset \$1";
	}

	protected function sql_filters($filters, &$params, &$sql_filters) {

		if (count($params) == 2 && $params[1] === null) {
			$params[1] = -1; // sqlite: limit -1 means there is no limit to number of rows
		}

		if (isset($filters['id']) && $filters['id']) {
			$params[] = $filters['id'];
			$p = '$' . count($params);
			$sql_filters[] = 'a = ' . $p;
		}
	}

}

?>